home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / createdir.c < prev    next >
C/C++ Source or Header  |  1996-10-10  |  989b  |  46 lines

  1. /* CreateDir.c   V1.0   93-03-15                        */
  2. /* ROM library: "dos.library/CreateDir", (All versions) */
  3. /* Copyright 1993, Anders Bjerin, Amiga C Club          */
  4.  
  5. #include <dos/dos.h>
  6.  
  7. #include <clib/dos_protos.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. UBYTE *version = "$VER: CreateDir 1.0";
  12.  
  13. int main( int argc, char *argv[] );
  14. int main( int argc, char *argv[] )
  15. {
  16.   BPTR my_dir_lock;
  17.  
  18.  
  19.   /* Create a directory: */
  20.   my_dir_lock = CreateDir( "RAM:MyDirectory" );
  21.  
  22.   /* OK? */
  23.   if( my_dir_lock == NULL )
  24.   {
  25.     /* We could not create the directory! */
  26.     printf( "Error! Could not create the new directory!\n" );
  27.     exit( 20 );
  28.   }
  29.   
  30.   /* We have successfully created the directory! */
  31.   printf( "The directory was successfully created!\n" );
  32.  
  33.   /* - - - */
  34.  
  35.   /* As soon as you do not need the lock on the */
  36.   /* directory any more you should unlock it!   */
  37.   UnLock( my_dir_lock );
  38.  
  39.   /* Inform the user: */
  40.   printf( "Directory unlocked!\n" );
  41.  
  42.   exit( 0 );
  43. }
  44.  
  45.  
  46.